import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedstate from 'vuex-persistedstate'
import user from './modules/user'
import repair from './modules/repair'

Vue.use(Vuex)

export default new Vuex.Store({
    modules: {
        user,
		repair
    },

    plugins: [
        createPersistedstate({
            paths: ['user'], // 要把哪些模块加入缓存
			storage: { // 存储方式定义
				getItem: key => uni.getStorageSync(key), // 获取
				setItem: (key, value) => uni.setStorageSync(key, value), // 存储
				removeItem: key => uni.removeStorageSync(key) // 删除
			}
        })
    ]
})
